{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import numpy, scipy, matplotlib.pyplot as plt, sklearn, librosa, urllib, IPython.display, stanford_mir\n",
    "plt.rcParams['figure.figsize'] = (14,5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[&larr; Back to Index](index.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# K-Nearest Neighbor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can appreciate why we need additional intelligence in our systems -- heuristics don't go very far in the world of complex audio signals.  We'll be using scikit-learn's implementation of the k-NN algorithm for our work here.  It proves be a straightforward and easy-to-use implementation.  The steps and skills of working with one classifier will scale nicely to working with other, more complex classifiers."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Training Data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's begin by loading some training data. We will use the following shortcut:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "training_features, training_labels, scaler = stanford_mir.get_features(collection=\"drum_samples_train\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Show the training labels. `0` is a kick drum, and `1` is a snare drum."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  1.  1.  1.  1.  1.  1.  1.  1.\n",
      "  1.  1.]\n"
     ]
    }
   ],
   "source": [
    "print training_labels"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Plot the training data:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x10c5e4950>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA0oAAAFICAYAAABujQ7PAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X90VPWd//HXhCQMJEOIGFitkLOAwLIUbGy/EORnAIuA\nmmBCJmEHw3KkbgGtgqDyW8MSEXT1sMjiClmQOjGGsPywLSCLWBpokILLTytN+dH6I4s1TSYZEjLz\n/SMyJTeEkZCZmx/Pxzmew713Zu67ybv3zCuf+/lci9fr9QoAAAAA4BNidgEAAAAA0NQQlAAAAADA\ngKAEAAAAAAYEJQAAAAAwICgBAAAAgAFBCQAAAAAMTAtKx44dk8PhqLM/OztbEyZMkMPhkMPhUFFR\nkQnVAQAAAGjNQs046Ztvvqlt27YpIiKizrETJ05oxYoV6tu3rwmVAQAAAIBJI0qxsbFavXq1rves\n2xMnTmjt2rVKT0/XunXrTKgOAAAAQGtnSlC6//771aZNm+seGz9+vF544QX913/9lz7++GPt27cv\nuMUBAAAAaPWa3GIOjz76qDp27KiwsDANHz5cJ0+evOHrrzcqBQAAAAC3wpQ5SvUpLS3VQw89pJ07\nd6pdu3Y6ePCgkpOTb/gei8Wi4uLSIFWIpiomxkYfQBK9gBr0AST6ADXoA0g1fXCzTA1KFotFkrRj\nxw6Vl5dr0qRJmj17tqZMmaLw8HANHjxYw4YNM7NEAAAAAK2QxdsC7l3jrwTgr0W4il6ARB+gBn0A\niT5AjYaMKDW5OUoAAAAAYDaCEgAAAAAYEJQAAAAAwICgBAAAAAAGBCUAAAAAMCAoAQAAAIABQQkA\nAAAADAhKAAAAAGBAUAIAAAAAA4ISAAAAABgQlAAAAADAgKAEAAAAAAYEJQAAAAAwICgBAAAAgAFB\nCQAAAAAMCEoAAAAAYEBQAgAAAAADghIAAAAAGBCUAAAAAMCAoAQAAA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Qp8ZQAAAABg\nknqD0qZNmyRJmZmZWrBgQdAKAgAAAACz+b31LiUlRU899ZQk6ezZs0pPT9fZs2cDXhgAAAAAmMVv\nUFqwYIESExMlST169NCMGTMYYQIAAADQovkNSm63W8OHD/dt33fffaqoqAhoUQAAAABgJr9BKTo6\nWj//+c/lcrlUVlamd999V506dQpGbQAAAABgCr9Bafny5dq3b5+GDBmihIQE7du3T8uWLQtGbQAA\nAABgCr8PnP3e976ndevW6ZtvvlFUVJQsFksw6gIAAAAA0/gdUTp16pTGjh2rhx9+WF988YVGjx6t\n48ePB6M2AAAAADCF36D04osvavXq1YqOjtYdd9yhpUuXasmSJUEoDQAAAADM8Z1WvevZs6dv+777\n7lNlZWVAiwIAAAAAM/kNSh07dtSpU6d829u2bVNUVFRAiwIAAAAAM/ldzGHx4sWaN2+ePvvsM917\n772KjY3VypUrg1EbAAAAAJjCb1CKjY2V0+nUl19+qerqat15553BqAsAAAAATOM3KJ06dUrz5s3T\nl19+KY/Hox49euill15SbGxsMOoDAAAAgKDzO0fp+eef11NPPaVDhw6psLBQ06ZN03PPPReM2gAA\nAADAFH6DkiSNHDnS9+8xY8aovLw8YAUBLY3b7VZ29i5lZ++S2+02uxwAAAB8B36D0sCBA7Vu3TqV\nlpbK5XLJ6XSqR48eunTpki5duhSMGoFmy+12KzU1X3PnPqS5cx9Samo+YQkAAKAZ8DtHadeuXZIk\np9NZa39KSoosFos++OCDwFQGtABO534VFEyVFCZJKijIkNO5XRkZ95tbGAAAAG7Ib1Dau3dvMOoA\nAAAAgCbjhrfe7d27VxcuXJAk7d69Wz/5yU/02muv6cqVK0EpDmju7PZhio/fIKlSUqXi47Nltw8z\nuywAAAD4UW9Qeuutt7R69Wq53W6dPn1ac+bM0ejRo+VyufTSSy8Fs0ag2bJarcrJSdKKFdu1YsV2\n5eQkyWq1ml0WAAAA/Kj31rutW7cqJydH7du318qVKzVq1CilpKTI6/XqgQceCGaNQLNmtVqZkwQA\nANDM1DuiFBISovbt20uSDh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AAPW6dOmSZs+erWXLlqlr166SpDfeeEP9+vXTSy+9pLKyMqWlpal///6SpK+++kq/+MUv\nFBISoieffFLx8fHKyMjQhQsXlJ6erq1bt6pTp06+zz99+nStkCRJISEhGjdunG+7qqpKO3fulCQl\nJyfr8ccf1+jRo3Xs2DE9+eST+uUvf6nXXntN7777rm677Tb927/9m/7whz9oz549GjlypKZNm6bf\n/va3OnLkiAYMGCBJslgskqSjR49q586dCgkJ0dixY5WWlqaLFy/qyJEj2rlzp8rLy5WUlKRRo0Zd\n9+eTmJioK1eu6NKlS+rRo4cWLlyo/v3769y5cyoqKlJOTo4kad68edq+fbumT58up9OpdevWqX37\n9lqwYIHWrVunv/u7v9NHH32khQsXasOGDY3wmwMA3CqCEgDgujwej2bPnq0JEybUCgq/+c1vdPny\nZeXl5UmSKioq9Nlnn8lisahv376++TmHDh3SsmXLJEldu3bVgAEDdOzYMSUkJPg+y2KxyOPx1FuD\nxWLxhRuXy6ULFy5o9OjRkqQBAwYoKipKRUVFGjlypNLS0jRq1Cj9+Mc/Vp8+fVReXq5Zs2bp5MmT\nGjFihCZPnuz73Kt3nf/gBz9Q+/btfTWWlJToN7/5jcaNG6fQ0FB16NBBo0ePVn13qW/dulVSza2J\neXl5Gj58uCQpNjZW8+bNU05OjoqKinT06FF169at1nv/+Mc/6sKFC3r88cd9+1wuV70/CwBAcLHq\nHQDgulavXq3q6mrNnj271n6v16uVK1dq69at2rp1q+/2OUmyWq21Xnctj8dTJxT169dPx48fr/O6\nGTNm6NKlS5Kktm3b+j7P+Jler1cej0fz58/X66+/ro4dO+qZZ57Rtm3bFBcXp507d2ro0KF6//33\nawWSq65+9rWf16ZNG1VXV9f7v+N6MjIy1LlzZ61YsUKSdPz4cf3zP/+zJGns2LHXDVsej0ddu3b1\n/Ry3bNmit99+2++5AADBQVACANRx4MABvffee3rllVfqrOA2aNAg/fznP5dUc6tdUlKSvvjiizpB\nYODAgXrvvfckSRcuXNDvfvc73XPPPbVek5qaqg8//FAffvihpJpQsmbNGn3zzTfq1KlTrc+MjIxU\n165dtXv3bkk1t8393//9n3r06KEf//jHio6O1vTp0/Xwww/r1KlTWrVqlf77v/9biYmJWrhwoU6e\nPPmd/rcPHjxYu3btUlVVlcrKyvThhx/6btW7keeee05btmzRmTNndPjwYQ0cOFCpqanq0aOHDhw4\n4AuJoaGhunLlirp3766SkhIdPnxYkpSXl6c5c+Z8pxoBAIHHrXcAgDrWrVvnW6jhWmlpaZoxY4aW\nLl2qBx98UNXV1ZozZ466du3q+8J/1YIFC7Ro0SLl5eXJYrFo2bJluv3222u95vbbb9ebb76pFStW\naOXKlfJ4PPrHf/xH/fu//7sk1QkoL7/8shYvXqzXX39dbdu21erVqxUeHq4nnnhCU6dOldVqVVRU\nlLKysny3Dubn5yskJERLlizxfebV/4wsFouGDx+u3/3ud0pKSlJUVJQ6d+5ca6Ts2tdeq2fPnkpK\nStKKFSv0r//6r5o1a5YSExMVHR2tYcOG6eLFi5KkESNG6LHHHtP69ev12muvadmyZbp8+bJsNpuy\nsrK+w28HABAMLA8OAMA1jh49qj/+8Y9KTExUVVWV7Ha7li9frl69epldGgAgiAhKAABco6SkRLNn\nz1ZxcbE8Ho8mTpyoqVOnml0WACDICEoAAAAAYMBiDgAAAABgQFACAAAAAAOCEgAAAAAYEJQAAAAA\nwICgBAAAAAAG/x9nfwH8z5ClIwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10c5dc750>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(training_features[:10,0], training_features[:10,1])\n",
    "plt.scatter(training_features[10:,0], training_features[10:,1], color='r')\n",
    "plt.xlabel('Zero Crossing Rate')\n",
    "plt.ylabel('Spectral Centroid')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Test Data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Compute features from a test data set of 30 kick drum samples and 30 snare drum samples. We will re-use the `MinMaxScaler` used during training."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Directory drum_samples_test already exists.\n"
     ]
    }
   ],
   "source": [
    "test_features, test_labels, _ = stanford_mir.get_features(collection=\"drum_samples_test\", scaler=scaler)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Show the test labels:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.\n",
      "  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  1.  1.  1.  1.  1.  1.\n",
      "  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.\n",
      "  1.  1.  1.  1.  1.  1.]\n"
     ]
    }
   ],
   "source": [
    "print test_labels"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Plot the test feature vectors. Note that this uses the same scaling function used during training. Therefore, some test feature vectors may exceed the range [-1, 1]."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x1072c8210>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA0YAAAFICAYAAAB0se5BAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9cVHW+x/H3gOAoTIqG3WrVm5V6vaa7truKKRr+WMub\ngYIMGkaxmZU/1izzt2Z6JbXcumpmW5JWDouKN7ItbU3da+hSrnbVsnLNtKw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BBNptNH3zwgT799FNN\nmTJFy5cv19VXXx3o0lAD//qv/6q2bdv6ft28eXMVFBTommuuuei1pgpGVfniiy80YcIEPffcc+rQ\noUOgywEavG7duun999/XHXfcob179/LvDjDI999/r/vvv1+zZ89Wjx49Al0OLtPGjRv13Xff6cEH\nH5TdbpfNZuNLJZN47bXXfL9OTU3V3LlzCUUmsmHDBh06dEizZ8/Wd999p+Li4mqnRJo+GD377LMq\nLy/XvHnzJElXXXWVli1bFuCqcLlsNptsNlugy0ANDBgwQDt37pTT6ZR0djokzIl/c+ayYsUKFRUV\nadmyZb7/n/vd737H2lqTGDRokKZMmaJ77rlHZ86c0fTp0xUeHh7osoAGLzExUVOnTtXIkSMlnf3c\nUt2XEjYvEyUBAAAAWBxjuAAAAAAsj2AEAAAAwPIIRgAAAAAsj2AEAAAAwPIIRgAAAAAsj2AEAAAA\nwPJMf44RAKDuffjhh77z4c777LPP9PTTT+uuu+6q03v99a9/1cKFC/X1119Lktq3b68ZM2YoKiqq\nTu9z3ujRozV//vxqD/irqY4dO6pjx46SJK/Xq6KiIvXq1Utz5sy55MGdU6dO1fjx43Xttdde0f0B\nAHWLc4wAAH5lZmbqzTfflMvlqtNDKb/77jslJibqqaeeUt++fSVJL774onbs2KHXX3+9zu5THzp2\n7KhPP/3U97i4uFh33XWXnnzyScXGxlb7c3FxcVqzZo2uv/56I8oEANQQI0YAgEv68MMPtWLFCmVn\nZys8PFwlJSWaO3euPv/8c3k8Hj3wwAMaPHiwNmzYoJycHP3www+Ki4tTamqqpk+frhMnTqhRo0aa\nOHGievfuXem9165dq169evlCkSQ98MADat26tSoqKrR8+XLt3btX3377re655x716NFDs2bNUmFh\noZo2barp06frlltuUW5url5++WWFhIToJz/5iRYvXqy///3veuyxx1RaWqqQkBDNmDFDXbt29QWT\n3bt3609/+pP++c9/6tixY7rttts0e/ZsSdIzzzyjzZs3KyoqStHR0YqLi1NCQsIl/5z+8Y9/qLS0\nVM2bN5ckLVmyRLt27dIPP/ygqKgoLV26VBs2bNDf/vY3Pfjgg3rttdf01VdfKSMjQ263W1FRUXry\nySf1k5/8pG4bCACoEYIRAKBaJ0+e1KRJkzR//ny1bt1akvTCCy+oc+fOevrpp1VcXKyUlBR16dJF\nkvS3v/1Nf/jDHxQSEqIJEyYoJiZGaWlpOnbsmEaMGKGNGzeqZcuWvvf/9NNPK4UiSQoJCdGdd97p\ne1xeXq5NmzZJkhITEzVmzBj1799f+/bt04QJE/TOO+/oueee0+9//3u1aNFCv/3tb/XXv/5V7733\nnm6//Xalp6frz3/+s/bs2aOuXbtKkmw2myRp79692rRpk0JCQjRo0CClpKTo+PHj2rNnjzZt2qRT\np04pISFB/fr1q/LPJz4+XmfOnNHJkyd14403aubMmerSpYuOHj2qI0eOKCsrS5L0xBNPKDc3V6NH\nj5bL5dLKlSvVtGlTzZgxQytXrtS//Mu/6E9/+pNmzpypVatW1UHnAACXi2AEAKiSx+PRpEmT9B//\n8R+VgsEHH3yg06dPa/369ZKk0tJSffHFF7LZbOrUqZNvfc3u3bs1f/58SVLr1q3VtWtX7du3T3Fx\ncb73stls8ng81dZgs9l8YaakpETHjh1T//79JUldu3ZVs2bNdOTIEd1+++1KSUlRv3799Ktf/Uod\nO3bUqVOnNG7cOB08eFB9+/bVyJEjfe97fhb5z372MzVt2tRXY2FhoT744APdeeedatSoka666ir1\n799f1c0637hxo6SzUw3Xr1+vPn36SJLatm2rJ554QllZWTpy5Ij27t2rNm3aVPrZL7/8UseOHdOY\nMWN8z5WUlFT7ZwEAqF/sSgcAqNLSpUtVUVGhSZMmVXre6/Vq8eLF2rhxozZu3OibDidJdru90ut+\nzOPxXBSCOnfurP3791/0ukceeUQnT56UJDVu3Nj3fhe+p9frlcfj0fTp0/X888+refPmevzxx/Xm\nm2+qW7du2rRpk3r37q233367UgA57/x7//j9QkNDVVFRUe3voyppaWlq1aqVFi5cKEnav3+/7r//\nfknSoEGDqgxXHo9HrVu39v05btiwQa+99prfewEA6gfBCABwkZ07d2rdunV69tlnL9phrUePHnrj\njTcknZ06l5CQoG+//faiD/7du3fXunXrJEnHjh3TX/7yF/30pz+t9Jrk5GRt375d27dvl3Q2hCxf\nvlw//PCDWrZsWek9IyMj1bp1a23ZskXS2Wlw33//vW688Ub96le/UlRUlEaPHq27775bn3zyiZ55\n5hn993//t+Lj4zVz5kwdPHiwRr/3nj17avPmzSovL1dxcbG2b9/um3p3KVOnTtWGDRt06NAhffjh\nh+revbuSk5N14403aufOnb5Q2KhRI505c0bt2rVTYWGhPvzwQ0nS+vXr9dhjj9WoRgBA3WMqHQDg\nIitXrvRtrPBjKSkpeuSRR/Tkk0/qrrvuUkVFhR577DG1bt3a9wH/vBkzZmjWrFlav369bDab5s+f\nr6uvvrrSa66++mq99NJLWrhwoRYvXiyPx6N///d/17JlyyTpokCyaNEizZ49W88//7waN26spUuX\nKjw8XOPHj9d9990nu92uZs2aKSMjwzcVMCcnRyEhIZozZ47vPc//dyGbzaY+ffroL3/5ixISEtSs\nWTO1atWq0kjYj1/7YzfddJMSEhK0cOFC/ed//qfGjRun+Ph4RUVFKTY2VsePH5ck9e3bVw888IBe\neeUVPffcc5o/f75Onz4th8OhjIyMGnQHAFAf2K4bAIAf2bt3r7788kvFx8ervLxcTqdTCxYsUPv2\n7QNdGgCgHhGMAAD4kcLCQk2aNEkFBQXyeDwaOnSo7rvvvkCXBQCoZwQjAAAAAJbH5gsAAAAALI9g\nBAAAAMDyCEYAAAAALI9gBAAAAMDyCEYAAAAALO//AKCpI4eMN7XcAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10d007d50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(test_features[test_labels==0,0], test_features[test_labels==0,1])\n",
    "plt.scatter(test_features[test_labels==1,0], test_features[test_labels==1,1], color='r')\n",
    "plt.xlabel('Zero Crossing Rate')\n",
    "plt.ylabel('Spectral Centroid')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Building the K-NN Model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Build a k-NN model for the snare drums using scikit.learn's [KNeighborsClassifier](http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html) class."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "model = sklearn.neighbors.KNeighborsClassifier(n_neighbors=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To train a scikit-learn classifier, use the classifier object's `fit` method:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "           metric_params=None, n_neighbors=1, p=2, weights='uniform')"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fit(training_features, training_labels)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To test the classifier on a set of (test) feature vectors, use the `predict` method:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\n",
       "        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\n",
       "        0.,  0.,  0.,  0.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,\n",
       "        1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,\n",
       "        1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.predict(test_features)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Evaluate the model accuracy on the test data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.score(test_features, test_labels)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[&larr; Back to Index](index.html)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
